<ui:composition 
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:p="http://primefaces.org/ui"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    template="template.xhtml">
    <ui:define name="title">Registracija</ui:define>
    <ui:define name="center">
        <table align="center">
            <tr>
                <td>
            <p:panel id="panel" header="Forma za registraciju:">
                <h:form>
                    <p:messages id="msgs" showDetail="true"/>
                    <h:panelGrid columns="2" cellpadding="3">
                        <h:outputLabel for="firstname" value="*Ime:"/>
                        <p:inputText id="firstname" value="#{registermanagedbean.firstname}" required="true" requiredMessage="Polje sa imenom ne sme biti prazno!"><p:focus/><f:validateLength for="firstname" minimum="3" maximum="10" ></f:validateLength></p:inputText>

                        <h:outputLabel for="lastname" value="*Prezime:"/>
                        <p:inputText id="lastname" value="#{registermanagedbean.lastname}" required="true" requiredMessage="Polje sa prezimenom ne sme biti prazno!"/>

                        <h:outputLabel for="dateOfBirth" value="Datum rodjenja:"/>
                        <p:calendar id="dateOfBirth" value="#{registermanagedbean.dateOfBirth}" requiredMessage="Niste odabrali datum rodjenja!"/>

                        <h:outputLabel for="email" value="*Email:"/>
                        <p:inputText id="email" required="true" value="#{registermanagedbean.email}" requiredMessage="Polje za email ne moze biti prazno!"/>

                        <h:outputLabel for="username" value="*Korisnicko ime:"/>
                        <p:inputText id="username" required="true" value="#{registermanagedbean.username}" requiredMessage="Polje za korisnicko ime ne moze biti prazno!"/>

                        <h:outputLabel for="password" value="*Sifra:"/>
                        <p:password id="password" required="true" feedback="true" minLength="5" value="#{registermanagedbean.password}" requiredMessage="Polje za sifrom ne moze biti prazno!" promptLabel="Unesite vasu sifru" weakLabel="Slaba" goodLabel="Dobra" strongLabel="Sigurna"/>
                        <h:outputLabel for="repassword" value="*Ponovite sifru:"/>
                        <p:password id="repassword" required="true" feedback="false" minLength="5" value="#{registermanagedbean.repass}" requiredMessage="Morate ponoviti sifru koju ste uneli!"/>
                        <p:ajaxStatus>  
                            <f:facet name="start">  
                                <h:graphicImage style="width: 30px;height: 30px;" value="/images/spinner.gif" />  
                            </f:facet>  

                            <f:facet name="complete">  
                                <h:outputText value="" />  
                            </f:facet>  
                        </p:ajaxStatus>  
                        <p:commandButton action="#{registermanagedbean.register()}" value="Register" update="panel"/>
                    </h:panelGrid>

                </h:form>
                <h:form>
                    <h:panelGrid columns="2" cellpadding="3">
                        <p:commandLink value="Login" action="/login.xhtml?faces-redirect=true" ajax="false"/>
                        <p:commandLink value="Resetovanje sifre" action="/forgot.xhtml?faces-redirect=true" ajax="false"/>
                    </h:panelGrid>
                </h:form>
            </p:panel>
            </td>
            </tr>
        </table>
    </ui:define>
</ui:composition>